<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Chimee</title>
    <script src="https://cdn.jsdelivr.net/npm/chimee@0.11.0/lib/index.browser.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/cdnbye@latest/dist/hlsjs-p2p-engine.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/p2p-chimee-kernel-hls@latest"></script>
    <style type="text/css">body, html, #player{padding: 0;margin: 0;width: 100%;height: 100%;background-color:#000;}</style>
</head>
<body oncontextmenu="return false" onselectstart="return false" style="overflow-y:hidden;">
<div id="player"></div>
<script>
function _get(name){
     var result = location.search.match(new RegExp("[\?\&]" + name+ "=([^\&]+)","i"));
     if(result == null || result.length < 1){
         return "";
     }
     return decodeURIComponent(result[1])
}
    new Chimee({
        wrapper: '#player',
        src: _get('url'),
        controls: true,
        autoplay: true,
        kernels: {
            hls: {
                handler: window.ChimeeKernelHls,
                maxBufferSize: 0,
                maxBufferLength: 5,
                liveSyncDuration: 30,
                p2pConfig: {
                    logLevel: 'debug',
                    live: false,
                    getStats: function (totalP2PDownloaded, totalP2PUploaded, totalHTTPDownloaded) {
                        var total = totalHTTPDownloaded + totalP2PDownloaded;
                        document.querySelector('#info').innerText = `p2p ratio: ${Math.round(totalP2PDownloaded/total*100)}%, saved traffic: ${totalP2PDownloaded}KB, uploaded: ${totalP2PUploaded}KB`;
                    },
                }
            }
        },
    });
</script>
<script>
        window.onload = function(){
            document.onkeydown = function (){
                var e = window.event || arguments[0];
                //F12
                if(e.keyCode == 123){
                    return false;
                //Ctrl+Shift+I
                }else if((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)){
                    return false;
                //Shift+F10
                }else if((e.shiftKey) && (e.keyCode == 121)){
                    return false;
                //Ctrl+U
                }else if((e.ctrlKey) && (e.keyCode == 85)){
                    return false;
                }
            };
            document.oncontextmenu = function (){
                return false;
            }
        }
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?efd38d819241f83dd00c6fe4b37c866d";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>